package com.xywy.me.adapter;

import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;

import com.xywy.R;
import com.xywy.common.constants.ResultCode;
import com.xywy.common.net.AsyncHttpClient;
import com.xywy.common.net.OnResultListenerAdapter;
import com.xywy.common.net.Parser;
import com.xywy.common.util.DialogUtils;
import com.xywy.common.util.MLog;
import com.xywy.common.widget.MyProgress;
import com.xywy.me.bean.Collect;

import java.util.HashMap;
import java.util.List;

/**
 * 名称: 我 - 收藏
 * 描述:
 *
 * 类型: JAVA
 * 最近修改时间:${date} ${time}
 * @since  2014/8/8
 * @author xgd
 */
public class CollectAdapter extends BaseAdapter {
    private static final String  TAG = "CollectAdapter";
    private Context mContext;
    private List<Collect> list;
    private Dialog  dlg;
    public CollectAdapter(Context context) {
        this.mContext = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    public void setData(List<Collect>  stringList){
        this.list = stringList;
    }

    public List<Collect>  getData(){
    	return list;
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Hold hold;
        if(convertView==null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.me_collect_item, null);

            hold = new Hold();

            hold.title = (TextView) convertView.findViewById(R.id.tv_me_collect_title);
            convertView.setTag(hold);
        }else{
            hold = (Hold) convertView.getTag();
        }
        final Collect  collect=list.get(position);

        //控件赋值
         hold.title.setText(collect.getTitle());
        return convertView;
    }

    public class Hold{
          TextView  title;      //内容
    }

}
